<?xml version="1.0" encoding="UTF-8"?>
	<!-- 
  Geologic Event mapping file
-->
<as:AppSchemaDataAccess xmlns:as="http://www.geotools.org/app-schema"
	xmlns:ogc="http://www.opengis.net/ogc" xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.geotools.org/app-schema AppSchemaDataAccess.xsd
                      http://www.opengis.net/ogc http://schemas.opengis.net/filter/1.1.0/expr.xsd">
	<namespaces>
		<!--
			declare here the namespaces and prefixes used by the parser to
			resolve <type> elements.
		-->
		<Namespace>
			<prefix>gsml</prefix>
			<uri>http://www.cgi-iugs.org/xml/GeoSciML/2</uri>
		</Namespace>
		<Namespace>
			<prefix>gml</prefix>
			<uri>http://www.opengis.net/gml</uri>
		</Namespace>
	</namespaces>
	<sourceDataStores>
		<DataStore>
			<id>GeologicEvent</id>
			<parameters>
				<Parameter>
					<name>directory</name>
					<!-- path can be relative to this file if starts with "file: -->
					<value>file:./</value>
				</Parameter>
			</parameters>
		</DataStore>
	</sourceDataStores>
	<catalog>mappedPolygons.oasis.xml</catalog>
	<targetTypes>
		<FeatureType>
			<!--
				State the needed xsd schemas to be loaded in order to make the
				schema-to-FeatureModel parse. Paths are relative to this file, or
				may be absolute URL's. Imports and includes at the schemas will be
				followed as long as they're relative paths.
			-->
			<schemaUri>commonSchemas_new/GeoSciML/geosciml.xsd</schemaUri>
		</FeatureType>
	</targetTypes>
	<typeMappings>
		<FeatureTypeMapping>
			<sourceDataStore>GeologicEvent</sourceDataStore>
			<sourceType>GeologicEvent</sourceType>
			<targetElement>gsml:GeologicEvent</targetElement>
			<attributeMappings>
				<AttributeMapping>
					<targetAttribute>gsml:GeologicEvent</targetAttribute>
				</AttributeMapping>				
				<AttributeMapping>
				    <!-- This is referred by Geologic Unit as Geologic History -->
					<targetAttribute>gml:name</targetAttribute>
					<sourceExpression>
						<OCQL>GEOLOGIC_UNIT_ID</OCQL>
					</sourceExpression>
					<ClientProperty>
 						<name>codeSpace</name> 
  						<value>'urn:cgi:classifierScheme:GSV:GeologicalUnitId'</value> 
  					</ClientProperty>
				</AttributeMapping>
				<!-- Event age is a single property, therefore no feature chaining is required -->
				<AttributeMapping>
  				    <targetAttribute>gsml:eventAge</targetAttribute> 
 					<targetAttributeNode>gsml:CGI_TermRangePropertyType</targetAttributeNode> 
  				</AttributeMapping>
 				<AttributeMapping>
  					<targetAttribute>gsml:eventAge/gsml:CGI_TermRange/gsml:lower/gsml:CGI_TermValue/gsml:value</targetAttribute> 
 					<sourceExpression>
  						<OCQL>ghminage</OCQL> 
  				    </sourceExpression>
 					<ClientProperty>
 						<name>codeSpace</name> 
  						<value>ghage_cdspace</value> 
  					</ClientProperty>
  				</AttributeMapping>
				<AttributeMapping>
  					<targetAttribute>gsml:eventAge/gsml:CGI_TermRange/gsml:upper/gsml:CGI_TermValue/gsml:value</targetAttribute> 
					<sourceExpression>
 						<OCQL>ghmaxage</OCQL> 
  					</sourceExpression>
 					<ClientProperty>
  						<name>codeSpace</name> 
  						<value>ghage_cdspace</value> 
  					</ClientProperty>
 				</AttributeMapping>
 				<!-- Feature chaining: event environment is a multi-valued property -->
				<AttributeMapping>
					<targetAttribute>gsml:eventEnvironment</targetAttribute>
					<sourceExpression>
						<OCQL>id</OCQL>
						<linkElement>gsml:CGI_TermValue</linkElement>
						<linkField>FEATURE_LINK[1]</linkField>
					</sourceExpression>
					<isMultiple>true</isMultiple>
				</AttributeMapping>
				<!-- Feature chaining: event process is a multi-valued property -->
				<AttributeMapping>
					<targetAttribute>gsml:eventProcess</targetAttribute>
					<sourceExpression>
						<OCQL>id</OCQL>
						<linkElement>gsml:CGI_TermValue</linkElement>
						<linkField>FEATURE_LINK[2]</linkField>
					</sourceExpression>
					<isMultiple>true</isMultiple>
				</AttributeMapping>
			</attributeMappings>
		</FeatureTypeMapping>
	</typeMappings>
</as:AppSchemaDataAccess>
